<template>
  <view>
    <navbar></navbar>
    <view class="agreement">
      <mp-html :content="agreement"></mp-html>
    </view>
  </view>
</template>

<script>
const app = getApp();
import navbar from "@/components/navbar/navbar";
const pageList = {
  'sale': {
    title: '寄售协议',
    api: 'page/orderSaleAgreement'
  },
  'given': {
    title: '转赠协议',
    api: 'user/transferRule'
  }
}

export default {
  components: {
    navbar
  },
  data() {
    return {
      agreement: ''
    }
  },
  onLoad(options) {
    this.page = pageList[options.type];
    this.requestData();
  },
  onReady() {
    uni.setNavigationBarTitle({
      title: this.page.title
    })
  },
  methods: {
    requestData() {
      app._get(this.page.api, null, (res) => {
        this.agreement = this.escape2Html(res.data);
      })
    }
  }
}
</script>

<style lang="scss" scoped>
	.agreement {
		padding: 20rpx;
		word-break: break-all;
	}

</style>
